package com.king.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author taomk
 * @version 1.0
 * @since 2014/10/20 18:06
 */
public final class TypeUtils {

	public final static Map<String, String> COLUMN_TYPE_MAP = new HashMap<>();

	static {
		COLUMN_TYPE_MAP.put("INT", "int");
		COLUMN_TYPE_MAP.put("BIGINT", "long");
		COLUMN_TYPE_MAP.put("INTEGER", "int");
		COLUMN_TYPE_MAP.put("TINYINT", "int");
		COLUMN_TYPE_MAP.put("SMALLINT", "int");
		COLUMN_TYPE_MAP.put("MEDIUMINT", "int");
		COLUMN_TYPE_MAP.put("FLOAT", "float");
		COLUMN_TYPE_MAP.put("DOUBLE", "double");
		COLUMN_TYPE_MAP.put("DECIMAL", "BigDecimal");

		COLUMN_TYPE_MAP.put("BIT", "boolean");
		COLUMN_TYPE_MAP.put("BOOLEAN", "int");
		COLUMN_TYPE_MAP.put("BOOL", "int");

		COLUMN_TYPE_MAP.put("VARCHAR", "String");
		COLUMN_TYPE_MAP.put("CHAR", "String");
		COLUMN_TYPE_MAP.put("TEXT", "String");
		COLUMN_TYPE_MAP.put("MEDIUMTEXT", "String");
		COLUMN_TYPE_MAP.put("LONGTEXT", "String");

		COLUMN_TYPE_MAP.put("BLOB", "byte[]");
		COLUMN_TYPE_MAP.put("MEDIUMBLOB", "byte[]");
		COLUMN_TYPE_MAP.put("LONGBLOB", "byte[]");
		COLUMN_TYPE_MAP.put("TINYBLOB", "byte[]");

		COLUMN_TYPE_MAP.put("BINARY", "byte[]");
		COLUMN_TYPE_MAP.put("VARBINARY", "byte[]");

		COLUMN_TYPE_MAP.put("DATE", "Date");
		COLUMN_TYPE_MAP.put("TIME", "Date");
		COLUMN_TYPE_MAP.put("DATETIME", "Date");
		COLUMN_TYPE_MAP.put("TIMESTAMP", "Date");
		COLUMN_TYPE_MAP.put("YEAR", "Date");
	}



	public final static Map<String, String> CLASS_IMPORT_MAP = new HashMap<>();

	static {
		CLASS_IMPORT_MAP.put("DATE", "java.util.Date");
		CLASS_IMPORT_MAP.put("TIME", "java.util.Date");
		CLASS_IMPORT_MAP.put("DATETIME", "java.util.Date");
		CLASS_IMPORT_MAP.put("TIMESTAMP", "java.util.Date");
		CLASS_IMPORT_MAP.put("YEAR", "java.util.Date");
		CLASS_IMPORT_MAP.put("DECIMAL", "java.math.BigDecimal");
	}
}
